package com.tensquare.articlecrawler.dao;
/*
 *ClassName:CommentDao
 *Description:
 *@author:可爱的大鸭子
 */

import com.tensquare.articlecrawler.pojo.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CommentDao extends JpaRepository<Comment,String>,JpaSpecificationExecutor<Comment> {
    //查询文章的评论列表
    @Query(value = "select * from tb_comment where aid=? and commentid=0 order by publishtime desc",nativeQuery = true)
    public List<Comment> getArticleComments(String aid);
    //获取评论的评论列表
    @Query(value = "select * from tb_comment where commentid=? order by publishtime desc",nativeQuery = true)
    List<Comment> getCommentComments(String cid);
}
